{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 热力图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "from iclientpy import viz"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "模拟数据，二维数组，格式如下：[[{纬度},{经度},{值}]...]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "data=[[39.86369678193944,116.25519414479928,33.46073333534289],[39.85730998494624,116.21477193093531,20.440150687928877],[39.989832394134794,116.33776205367147,31.34193668344384],[39.85090712264135,116.23216977914424,63.82125670734739],[39.81755771646532,116.40395162558073,50.160771966863265],[39.8029996989665,116.37434535967591,46.21967155674653],[39.92480269376725,116.46942234894462,29.928912281726276],[40.01058278468289,116.25252184155006,56.09896890395079],[39.914158948076086,116.19140276663337,65.72546639595953],[39.94528188010366,116.13724944604742,14.603273957861855],[40.045455636442696,116.26752278278428,47.53737681840921],[39.925539036306766,116.56003570026313,53.95284234631076],[39.80592469422142,116.12298935835875,12.648151009089315],[39.79770821304627,116.31668826776873,26.425867239798233],[39.94177391687501,116.47905531201465,25.099324357358146],[40.043229661285444,116.32449571855445,48.90404816482588],[39.79862306865246,116.25271428999571,4.463630671753105],[39.83031365446805,116.34276567048427,26.20377604201204],[39.93137948046766,116.56750037315011,21.46342219679246],[39.943374875133514,116.41134429962091,52.18621929114397],[39.93414683690004,116.55691731218452,9.897925865440147],[39.987762316196346,116.608910295329,67.94219339752712],[39.82763302109797,116.48211910214356,8.358415494551927],[39.78980913745548,116.19040278449114,43.323911877228554],[39.818425720099576,116.54135338376355,69.00261059522423],[40.00330690551562,116.14508777082816,45.02370535191201],[39.86941454056497,116.21738365143982,21.37896096153149],[39.896009492917194,116.1647850207495,53.1925200673475],[39.83396637707625,116.25222058162745,78.24890709046294],[39.868516290138324,116.61318495945564,51.641969898774924],[39.78247977464388,116.61925895538062,71.66658487465462],[39.82313121957675,116.29426617327296,57.161326750157556],[39.814485994808884,116.12294507463382,51.30433280187761],[39.85622215866992,116.44596963776436,67.00666751997485],[40.0156323756824,116.29765327418261,79.71935015782749],[40.003911171423844,116.45098541061797,36.33069452634668],[39.99392248226563,116.17330644350355,16.83715675165283],[39.88638531883492,116.49136952125414,38.006266747457964],[39.973603767254275,116.1970674320544,32.334025531267],[40.02219488332441,116.33224052025554,54.255722913930704],[40.055930940246874,116.15356201731501,12.582300223594434],[39.83078654367175,116.59434793715981,15.795730724560784],[39.823087071940776,116.61074572383448,53.47551196287546],[39.91586395021955,116.21408924682206,31.43534346649126],[39.83262460031038,116.2701438316924,33.561136136910754],[40.04519778925843,116.12295243566184,62.01557435247396],[39.84951085262909,116.15797175901974,5.735051346309383],[39.94390700193526,116.20624322036983,30.437677558700322],[39.89408821759331,116.19125905954404,32.32172640294355],[40.03448863999862,116.29119353160954,76.78723747960106],[40.0028739537446,116.59128971709123,57.32244094817885],[39.99671924651913,116.34071192211513,28.969177571863884],[40.02861353530865,116.12106325839633,30.077713048805652],[39.97938731883366,116.1514649791524,23.77347041561368],[39.85948732000907,116.35848351737067,1.7245967718065103],[39.81358168732597,116.27227963386026,33.56738806894484],[39.799844843856455,116.15224327810412,5.5894569175211295],[39.96806392247463,116.353884075289,65.32395417796151],[40.03587090341989,116.56843054649947,41.60901502084524],[39.90810507372096,116.58843898234407,7.01072956546696],[40.039353274214044,116.14322062027495,65.72766615093288],[39.785202360743455,116.13040793516952,21.199180914290867],[39.83597216963147,116.45370875727221,52.63799002658308],[40.012760065723896,116.52462840449765,66.08211316717282],[39.92302361697735,116.46943616462376,76.43976464989493],[39.88978636184872,116.15863022422323,4.764517446507437],[39.94692289644395,116.4606352790659,73.79593393261723],[39.968922795858234,116.3417274176148,75.36354841418047],[39.83873476263837,116.43490427893545,36.748177165032786],[39.99141979699271,116.41581756744509,66.81042674444286],[39.781125384139536,116.3691184290045,69.3458617587074],[39.93455685187373,116.30946079504746,4.985105954194609],[39.94105068136618,116.22217759415116,77.23250940372122],[40.02040249392601,116.13832932886567,70.0524731202234],[39.97316933691705,116.15371193115394,23.80288041403153],[40.03583748734385,116.23487636685877,42.76893587106423],[39.85176679844431,116.19098845221066,3.928109098917272],[40.01107508237486,116.35304400997259,72.64914283119731],[40.051906107805856,116.24279736008542,53.906017587294045],[39.958973495809964,116.12764083675391,67.79540574484218],[40.04508347457779,116.59186142694396,74.63483751528332],[40.04702309843518,116.33117190056413,11.056258711699574],[39.8612399658406,116.24931467271156,78.71434564063694],[39.92123555034331,116.5996040989596,46.827895335437034],[40.05964772899896,116.34241419358993,50.626985538518895],[40.05006927374305,116.57763602209468,5.232742502695373],[39.84155105956311,116.27581435822195,63.296157624330114],[40.04497180045136,116.37545451980296,43.06610147454936],[40.034244507680974,116.51309575579882,43.79727764663576],[39.979134837432326,116.58739353741021,5.379513866432966],[40.02359528109301,116.48134778186879,42.14739005436016],[39.822800869968916,116.521182655626,4.9627646001590975],[40.00468399626881,116.46701877596853,43.93123454518669],[39.88447443700631,116.61906383819694,60.88718252673209],[39.79499237038538,116.5725306434961,70.20559334653638],[39.83360360619079,116.53398427487562,68.72488828828331],[39.78297316537668,116.28037540526164,70.99885794979505],[39.78675288618628,116.13991886761607,19.160087874007417],[39.821408413390685,116.34020479755944,53.631356892379344],[39.89567545098363,116.19885255505888,48.69469057926713],[39.889288965411666,116.48089230047084,71.23430658242384],[39.96688703752165,116.40195113435033,47.3081751002632],[39.83722264442418,116.51138032034883,60.088731212157924],[39.914017424133995,116.59282854565119,57.385108386136],[39.81887377407524,116.4461862529893,36.680572367838394],[39.93034930926577,116.44345720812667,78.62842457421121],[40.01256418539093,116.43743151854902,9.604085010545589],[40.025245377533764,116.40181214163756,45.719701041288815],[39.95697131912753,116.56653347962789,43.87385027715862],[39.859242613763236,116.51677042114116,3.167071475544443],[39.81519944125622,116.42496737404086,34.277314528138234],[40.05360658436942,116.37557153989684,25.164625360007733],[39.85069021779968,116.33531310805226,35.664699184154514],[39.83590721142164,116.50174533944124,66.09188337593835],[39.98738130614786,116.290576665494,22.291806094546267],[39.809473260342166,116.4113676447463,0.10912559756937057],[39.86190974735216,116.42184920475569,45.21980539464744],[39.883146530293565,116.53087329341119,50.558282768326315],[39.99252755498483,116.1898084830398,45.69357217965976],[40.02730697672088,116.39323506937164,1.1395130273024279],[39.89668378160518,116.15359983442514,44.693071510471256],[40.01335759826944,116.48555420396893,66.19820675958707],[39.9037240806869,116.22970334059566,26.62441677612856],[40.03930355442093,116.56144936497046,8.104101856561634],[39.9168086966504,116.51074138618506,69.04702592621307],[40.04826680793387,116.17510336240763,23.88838886821521],[39.96319332726026,116.46343511370898,23.612587550891835],[40.032820462476295,116.583414366987,9.230575863226225],[39.97324629564666,116.61682208552965,28.440932836566617],[40.00849270721009,116.15868066501562,3.426888942793518],[39.90783669524441,116.3930194412776,48.91171948173094],[39.83042008221177,116.42718123977721,29.963702478914627],[40.01379730521672,116.15073712958652,44.007154819494275],[39.98210047951195,116.61583254371654,17.940644896138522],[39.92686379747845,116.2483263532871,6.415354358575609],[39.96406536598308,116.38782160588379,42.161191689975524],[39.81242687347167,116.33432398782463,9.661047765561257],[40.0431986058243,116.61441242773327,35.53539853097641],[39.88312890122259,116.27537001840176,56.97885277657971],[39.78370678176544,116.23312306499086,41.46379719892023],[39.80397061597267,116.46422234541656,21.04109151726126],[39.82771158440451,116.34545177079492,9.931385095498744],[39.989885483105745,116.34415597220945,29.8581448097824],[39.99784348295173,116.38597710669993,41.59782630835261],[40.02451187427286,116.25988991982186,75.20554878593816],[39.8066767337555,116.20877372983992,16.66578428998113],[39.80893060438385,116.16120916484236,69.4651305963068],[39.98616713619594,116.23968527000751,60.81585169907362],[39.847840796698456,116.13324793511008,57.22691597503374],[39.932204380615865,116.24379083509697,29.590924281606732]]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "生成热点图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "chart=viz.heat(data=data, radius=25, min_opacity=0.5, blur=50)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "显示地图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "001fca66a5b74a4fa8304dd8a12111fd",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "MapView(basemap={'url': 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', 'max_zoom': 19, 'attribution': '…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "chart"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "可视化交互，动态调整专题图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "0f0317fb0ac940689eee3e45cece6f63",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "VBox(children=(IntSlider(value=25, continuous_update=False, description='半径:', layout=Layout(width='350px'), m…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "chart.interact()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
